package com.zys.el.user.quartz;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {
    /*========================================资讯定时器=========================================================*/
    @Bean
    public JobDetail printJobDetail(){
        return JobBuilder.newJob(InfoQuartz.class).withIdentity("InfoQuartz").storeDurably().build();
    }
    @Bean
    public Trigger printJobTrigger(){
        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0 0 */2 ? * *");
//        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0/50 * * * * ?");
        return TriggerBuilder.newTrigger().forJob(printJobDetail()).withSchedule(schedBuilder).build();
    }
    /*========================================加载所有用户排行榜加载定时器=========================================================*/
    @Bean
    public JobDetail printJobDetailSy(){
        return JobBuilder.newJob(SynthesizeQuaetz.class).withIdentity("SynthesizeQuaetz").storeDurably().build();
    }
    @Bean
    public Trigger printJobTriggerSy(){
        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0 0 */2 ? * *");
//        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0/52 * * * * ?");
        return TriggerBuilder.newTrigger().forJob(printJobDetailSy()).withSchedule(schedBuilder).build();
    }
//
//    /*========================================各用户完成度加载定时器=========================================================*/
//    @Bean
//    public JobDetail printJobDetailFi(){
//        return JobBuilder.newJob(FinnishedQuartz.class).withIdentity("FinnishedQuartz").storeDurably().build();
//    }
//    @Bean
//    public Trigger printJobTriggerFi(){
//        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("30 50 16 * * ?");
////        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0/50 * * * * ?");
//        return TriggerBuilder.newTrigger().forJob(printJobDetailFi()).withSchedule(schedBuilder).build();
//    }
//
//    /*========================================各用户笔记数据加载定时器=========================================================*/
//    @Bean
//    public JobDetail printJobDetailND(){
//        return JobBuilder.newJob(NoteDataQuartz.class).withIdentity("NoteDataQuartz").storeDurably().build();
//    }
//    @Bean
//    public Trigger printJobTriggerND(){
//        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("30 30 16 * * ?");
////        ScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule("0/52 * * * * ?");
//        return TriggerBuilder.newTrigger().forJob(printJobDetailND()).withSchedule(schedBuilder).build();
//    }
}